package main

import (
	"fmt"
)

type dog struct {}

type person struct {}

type cat struct {
}

type speaker interface {
	speak(x string)
}



func (c cat) speak(name string) {
	fmt.Printf("%s揍了小猫一顿,猫咪喵喵的叫!", name)
}


func (p person) speak(name string)  {
	fmt.Printf("%s给了人一巴掌,人嘤嘤嘤的叫！", name)
}

func (d dog) speak(name string)  {
	fmt.Printf("%s踢了狗一脚，狗汪汪汪的叫！", name)
}

// 需求 传入的结构体不一样，传递进来什么就执行什么
func da(x speaker,name string) {
	x.speak(name)
}

func main() {
	d1 := dog{}
	da(d1, "肖禹庭")

	p1 := person{}
	da(p1, "钟祥兵")

	c1 := cat{}
	da(c1, "来娃娃")
}
